package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iPlayDAO;
import xupt.se.ttms.idao.iSaleDAO;
import xupt.se.ttms.model.Play;
import xupt.se.ttms.model.Sale;

public class SaleSrv {
	private iSaleDAO saleDAO=DAOFactory.creatSaleDAO();
	public boolean add(Sale sale) throws Exception{
		
		return saleDAO.execInsert(sale);
	}
	
	public boolean modify(Sale sale) throws Exception{
		return saleDAO.execUpdate(sale);	
	}
	
	public boolean delete(int ID) throws Exception{
		return saleDAO.execDelete(ID);		
	}
	
	public List<Sale> Fetch(Integer order_id) throws Exception{
		ResultSet resultSet=saleDAO.execQuery(order_id);	
		return saleDAO.HandleSaleResultSet(resultSet);	
	}
	
	public List<Sale> FetchAll() throws Exception{
		ResultSet resultSet=saleDAO.exexQueryAll();
		return saleDAO.HandleSaleResultSet(resultSet);		
	}
}
